<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{monitoring/layout}">

<head>
    <title th:text="#{cas.attrresolutionview.pagetitle}"></title>
    <script th:inline="javascript">
        /*<![CDATA[*/

        var urls = {
            resolveAttributes: /*[[@{/status/attrresolution/resolveattrs}]]*/,
            releaseAttributes: /*[[@{/status/attrresolution/releaseattrs}]]*/
        };

        /*]]>*/
    </script>
    <script type="text/javascript" th:inline="javascript">

        function jqueryReady() {
            head.load(
                /*[[@{/js/attrresolution.js}]]*/
            );
        }
    </script>
</head>

<body>
<div layout:fragment="content">
    <div id="attrResolution">
        <ul class="nav nav-tabs">
            <li class="nav-item"><a data-toggle="tab" class="nav-link active" href="#attributeResolutionPanel"
                                    th:text="#{cas.attrresolutionview.pagetitle}"/></li>
            <li class="nav-item"><a data-toggle="tab" class="nav-link" href="#attributeReleasePanel"
                                    th:text="#{cas.attrreleaseview.pagetitle}"/></li>
        </ul>

        <div class="tab-content clearfix">
            <div class="tab-pane active" id="attributeResolutionPanel">
                <h3 th:text="#{cas.attrresolutionview.pagetitle}"/>
                <p>Allow CAS to execute a query against configured attribute repositories to determine the set of
                    attributes that may be retrieved and resolved for
                    a given user. Note that this functionality is only productive if CAS is configured to
                    <strong>NOT</strong> directly retrieve attributes as part of
                    the authentication attempt.
                <p/>

                <div class="" id="">

                    <form method="post" id="fm1" class="">
                        <div class="form-group">
                            <label for="uid" class="fl-label" th:utext="#{cas.attrresolutionview.label.uid}"></label>
                            <input type="text" class="form-control"
                                   size="35"
                                   tabindex="0"
                                   id="uid"
                                   name="uid"
                                   autocomplete="off" required/>
                        </div>
                        <input class="btn btn-success"
                               name="_eventId_submit"
                               accesskey="l"
                               th:value="#{cas.attrresolutionview.button.submit}"
                               tabindex="1"
                               id="submitResolve"
                               type="submit"/>
                    </form>

                    <div class="alert alert-info" id="status"></div>

                    <table id="attributesTable" class="table table-striped table-bordered mt-3">
                        <thead>
                        <tr>
                            <th>Attribute</th>
                            <th>Value(s)</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>

                </div>
            </div>

            <div class="tab-pane" id="attributeReleasePanel">
                <h3 th:text="#{cas.attrreleaseview.pagetitle}"/>
                <p>Allow CAS to determine the collection of attributes that will be released to a given application. The
                    application will be matched against the CAS service registry to find the corresponding record whose
                    associated policies determine released attributes, etc.
                <p/>

                    <form method="post" id="fmrel" class="">
                        <div class="form-group">
                            <label for="username" class="fl-label">Username:</label>
                            <input type="text" class="form-control"
                                   size="35"
                                   tabindex="0"
                                   id="username"
                                   name="username"
                                   placeholder="Username..."
                                   autocomplete="off" required/>
                        </div>
                        <div class="form-group">
                            <label for="password" class="fl-label">Password:</label>
                            <input type="password" class="form-control"
                                   size="35"
                                   tabindex="0"
                                   id="password"
                                   name="password"
                                   placeholder="Password..."
                                   autocomplete="off" required/>
                        </div>
                        <div class="form-group">
                            <label for="service" class="fl-label">Service:</label>
                            <input type="text" class="form-control"
                                   size="35"
                                   tabindex="0"
                                   id="service"
                                   name="service"
                                   placeholder="Application URL (i.e. https://app.example.org)"
                                   autocomplete="off" required/>
                        </div>
                        <input class="btn btn-success"
                               name="_eventId_submit"
                               accesskey="l"
                               th:value="#{cas.attrresolutionview.button.submit}"
                               tabindex="1"
                               id="submitRelease"
                               type="submit"/>
                    </form>

                    <div id="validationresult" class="mt-3">
                        <h3>Response</h3>
                        <div id="validationresponse"></div>
                        <ul class="nav nav-tabs">
                            <li class="nav-item"><a data-toggle="tab" class="nav-link active" href="#cas1">CAS v1</a>
                            </li>
                            <li class="nav-item"><a data-toggle="tab" class="nav-link" href="#cas2">CAS v2</a></li>
                            <li class="nav-item"><a data-toggle="tab" class="nav-link" href="#cas3Xml">CAS v3 XML</a>
                            </li>
                            <li class="nav-item"><a data-toggle="tab" class="nav-link" href="#cas3Json">CAS v3 JSON</a>
                            </li>
                            <li class="nav-item"><a data-toggle="tab" class="nav-link" href="#serviceJson">Service</a>
                            </li>
                        </ul>

                        <div class="tab-content">
                            <div class="tab-pane active" id="cas1"></div>
                            <div class="tab-pane" id="cas2"></div>
                            <div class="tab-pane" id="cas3Xml"></div>
                            <div class="tab-pane" id="cas3Json"></div>
                            <div class="tab-pane" id="serviceJson"></div>
                        </div>
                    </div>
            </div>
        </div>

        <div>
            <div th:replace="monitoring/fragments/footerButtons"/>
        </div>
    </div>

</div>
</body>
</html>
